<template>
    <div class="pagination">
        <el-pagination
            v-if="total"
            layout="prev, pager, next,total"
            :total="total"
            :page-size="pageSize"
            @current-change="getList"
            :current-page.sync="listCurrentPage"
        ></el-pagination>
    </div>
</template>
<script>
export default {
    props: {
        total: {
            //总数
            default: 0,
        },
        pageSize: {
            //每页条数
            default: 10,
        },
    },
    data() {
        return {
            listCurrentPage: 1,
            currentPage: 1,
        };
    },
    methods: {
        getList() {
            //点击页码
            this.$emit('callBackFn', this.listCurrentPage);
            this.currentPage = this.listCurrentPage;
        },
        defaultPage() {
            //页码重置为第一页
            this.listCurrentPage = 1;
            this.$emit('callBackFn', 1);
        },
        refreshPage() {
            //刷新当前页数据
            this.$emit('callBackFn', this.currentPage);
        },
    },
};
</script>
<style lang="scss"></style>
